﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using UcAsp.Models;
namespace UcAsp.Controllers
{
    public class CollegeController : Controller
    {
        //
        // GET: /College/
        private UcAspNetEntities entities = new UcAspNetEntities();
        public ActionResult Index(int? id)
        {
            Articles art = new Articles();
            art = entities.Articless.OrderBy(o => o.ID).FirstOrDefault(c => c.CategorieID == 10 && c.IsRecommend == true);
            List<Articles> list = new List<Articles>();
            if (art != null)
            {
                list = (from c in entities.Articless
                        where c.CategorieID == 10 && c.IsRelease == true && c.ID != art.ID
                        orderby c.ID ascending
                        select c).ToList();

            }

            ViewData["articles"] = art;
            ViewData["Show"] = id;
            if (id == null)
            {
                ViewData["All"] = true;
                ViewData["Show"] = 99;
            }
            else
            {
                ViewData["All"] = false;
            }

            return View(list);
        }

    }
}
